/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */
package org.skatiger.jrove;

import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.net.URL;
import java.util.Iterator;
import java.util.Locale;
import java.util.Map;
import java.util.Set;

import javax.servlet.http.Cookie;

public interface ExternalContext {
    /**
     * application context map
     * 
     * @return map of servlet context
     */
    Map<String, Object> getApplicationMap();

    /**
     * Http request AuthType
     * 
     * @return
     */
    String getAuthType();

    /**
     * 
     * @return current ServletContext
     */
    Object getContext();

    /**
     * Servlet init param
     * 
     * @param name
     *            param of name
     * @return
     */
    String getInitParameter(String name);

    Map<String, String> getInitParameterMap();

    String getRemoteUser();

    Object getRequest();

    String getRequestCharacterEncoding();

    String getRequestContentType();

    String getRequestContextPath();

    Map<String, Cookie> getRequestCookieMap();

    Map<String, String> getRequestHeaderMap();

    Map<String, String[]> getRequestHeaderValuesMap();

    Locale getRequestLocale();

    Iterator<Locale> getRequestLocales();

    Map<String, Object> getRequestMap();

    Map<String, String> getRequestParameterMap();

    Iterator<String> getRequestParameterNames();

    Map<String, String[]> getRequestParameterValuesMap();

    String getRequestPathInfo();

    String getRequestServletPath();

    URL getResource(String path) throws java.net.MalformedURLException;

    InputStream getResourceAsStream(String path);

    Set<String> getResourcePaths(String path);

    Object getResponse();

    String getResponseCharacterEncoding();

    String getResponseContentType();

    Object getSession(boolean create);

    Map<String, Object> getSessionMap();

    java.security.Principal getUserPrincipal();

    boolean isUserInRole(final String role);

    void log(final String message);

    void log(final String message, Throwable throwable);

    void release();

    void setRequestCharacterEncoding(String encoding) throws UnsupportedEncodingException;

    void setResponseCharacterEncoding(String encoding);

    String encodeURL(String urlStr);

}
